Much thanks to Symantec for providing such a wonderful C compiler and environment for the Macintosh. And thanks of course to Apple Computer for producing such a good computer.
What?
"Chuck's Printer Driver" is a printer driver -- chooser device for using Epson dot-matrix printers (and compatibles) with your Macintosh computer. It has been tested on a Macintosh SE and a Macintosh IIci (systems 6.0.5 through 7.1, English and Kanji versions), with a Panasonic KX-P1080i printer. It prints in Text (draft or NLQ) mode and Graphics (Low, Medium, and High) modes. It is Freeware, however I do request a small donation ($20 U.S.) to help pay for my costs. I would like to hear what you think of it, and what I should add, even if you don't send me money. Note: There are still bugs in the text printing option, but the graphics modes should work fine. (I really don't want to support text printing that much, there is a better public-domain printer driver already that does a good job of that called "Daisy".)
How?
You can use the printer driver by dropping it into your system folder, and selecting it from the chooser desk accessory. You should also take time to choose the set-up option in chooser so that the printer driver knows how to access your printer and what type of printer it is. You need to have some sort of serial to parallel converter if you are trying to hook-up a printer that only has a parallel port -- see your printer manual. The Grappler 9-pin interface can be turned into a simple serial to parallel converter by setting all of its dip-switches to the ON position. Otherwise, talk to your local computer retailer about getting a serial-to-parallel converter. They can range anywhere from $30 (US dollars) to several hundred for fancy ones with large memory buffers.
How do I hook up my serial printer to my Macintosh?
If you have a serial printer, that is, one with an RS232 or RS422 interface, all you need is a serial cable from your computer to your printer. These can be bought from your local computer dealer.
If you wish to make your own Macintosh serial to RS232 cable, these are the pin connections for a 8pin mini-din Macintosh serial port to the standard RS232 pin outs.
Mac pin RS232 pin Description
1 20&4 Handshake Out
2 8 Handshake Input
4&8 7 Ground
5 3 Receive Data
3 2 Transmit Data
Depending on the printer, you may have to null-modem that cable, which would mean switching pins 5 &3 and also pins 1 & 2 at the Macintosh connector.
Where?
I can most likely be reached by internet e-mail to roach@khan.cs.wisc.edu, roach@saavik.cs.wisc.edu, or rentmees@cae.wisc.edu. I read this mail approximately once a week, and will respond via internet e-mail usually within a day. I can also be reached by US mail:
Charles Rentmeesters
410 North Carroll St
Madison, WI 53703-1804
U.S.A.
Why?
After receiving the 9-pin Grappler interface, and being disappointed in the way that it handled things, I decided to write my own printer driver in software. A software version would have more options and control over the original printer, where the Grappler only used the Imagewriter driver and did conversion in hardware. I thought this was a tremendous kludge.
When?
Version 1.0.0 is available now. New versions will be released when I receive enough feedback to release a new version.
Disclaimer
The Printer Driver is freeware, copy it and give it to all your friends. This program can not and should not be sold for any price, it is free. (I would like a donation of $20 though, if you use the printer driver). I do not take any responsibility for the use of my software, use at your own risk, it may have bugs.
Technical
The program uses the following printer control codes (Epson 9-pin mode):
For draft and NLQ modes:
ESC x 1 Set NLQ mode
ESC x 0 Set draft mode
ESC - 1 Underline On
ESC - 0 Underline Off
ESC E Bold printing on
ESC F Bold printing off
ESC 4 Italics on
ESC 5 Italics off
ESC 2 Set scrolling to 1/6 of an inch
ESC A <x> Set scrolling to x/72 inches
For graphics mode:
ESC K Enter graphics mode, 60dpi
ESC * 5 Enter graphics mode, 72dpi
ESC * 4 Enter graphics mode, 80dpi
ESC * 6 Enter graphics mode, 90dpi
ESC L Enter graphics mode, 120dpi
ESC Z Enter graphics mode, 240dpi
ESC A <x> Set scrolling to x/72 inches
ESC 2 Set scrolling to 1/6 of an inch
ESC 3 <x> Set scrolling to x/216 inches
How do I modify the printer codes?
If you have the program ResEdit, you can modify the printer codes that the printer driver uses to print. There are two resource types that you can modify, ResEdit templates ('TMPL' resources) are included in the Printer Driver to allow you to easily modify the resources. First there is the 'Pdcf' resource, it describes the Paper Page Definitions in the Page Setup Dialog, and it also tells the printer driver what resolution to print at for graphic low, medium, and high quality printing. Second is the 'Ptyp' resource. The 'Ptyp' resource tells the Printer Driver what codes to send to the printer.
The 'Pdcf' Resource
The 'Pdcf' Resource Has the following format:
Data type ResEdit type Description
short DWRD horz low resolution
short DWRD vert low resolution
short DWRD horz medium resolution
short DWRD vert medium resolution
short DWRD horz high resolution
short DWRD vert high resolution
short DWRD horz default resolution
short DWRD vert default resolution
LSTB Up to 6 page definitions will be put in the Style
Dialog.
boolean BOOL set if next description is in metric
long DLNG Width in thousand's of a cm for metric and
thousand's of an inch for non-metric
long DLNG Height in thousand's of a cm for metric and
thousand's of an inch for non-metric
long DLNG Left border (same scale as above)
long DLNG Right border (same scale as above)
long DLNG Top border (same scale as above)
long DLNG Bottom border (same scale as above)
char [] ESTR Name of the page type
LSTE
'Pdcf' number 0 is the one that is currently being used by the printer. From the chooser setup you can choose which of these resources is number 0. The pop-up menu called "Dialog setup" is made from the names of the 'Pdcf' resources, so it is important to name any new 'Pdcf's that you make.
The 'Ptyp' Resource
The 'Ptyp' resource has the following format:
Data type ResEdit type Description
char [] ESTR Name of Printer Type
short OCNT Number of Text Commands
LSTC
short DWRD Text Command, one of:
0 - Set NQL Mode
1 - Set Draft Mode
2 - Underline On
3 - Underline Off
4 - Bold On
5 - Bold Off
6 - Italics On
7 - Italics Off
8 - Reset
char [] ESTR Text Command Code
LSTE
short OCNT Number of Scroll Commands
LSTC
short DWRD Scroll Resolution in fractions of an inch
(i.e. To scroll x/72 this number would be 72)
short DWRD Scroll Type, one of:
0 - Scroll Immediately, variable amount
(i.e. scroll x/216)
1 - Set Line Feed, fixed amount
(i.e. set line-feed to scroll 1/6)
2 - Set Line Feed, variable amount
(i.e. set line-feed to scroll x/72)
char [] ESTR Scroll Command Code
LSTE
short OCNT Number of Printhead modes
LSTC
short DWRD Number of pins in this printhead-mode, one of:
8 - for 9-pin printers
24 - for 24-pin printers
short DWRD Distance between each pin on the print head in
fractions of an inch. Usually:
72 - for 9-pin printers (1/72 inch)
60 - for 24-pin printers w/8 pins printing (1/60 in.)
180 - for 24-pin printers w/24 pins printing
short OCNT Number of Horizontal Resolutions for this Printhead
mode
LSTC
short DWRD Horizontal Resolution in fractions of an inch.
char [] ESTR Graphics Printing Code
LSTE
LSTE
'Ptyp' number 0 is the one that is currently being used by the printer. From the chooser setup you can choose which of these resources is number 0. The pop-up menu called "Printer type" is made from the names of the 'Ptyp' resources, so it is important to name any new 'Ptyp's that you make. For the code strings you can place control characters in as a caret character ('^') followed by a second character. That second character is ANDed with hex 1F to get the control character. (i.e. "^A" is interpreted as $01, "^J" is interpreted as $0A). To put a caret character ('^') in the control string, you must put two caret characters (i.e. "^^").
The 'PSET' 0 Resource
This contains information about the serial port to open up, as set by the Chooser Code. It is written to whenever you leave the Setup dialog in the chooser with the response of OK. The structure of this resource is:
typedef struct {
SerShk Handshake;
short serConfig;
char deviceName[20];
} mySetup;
Notice: if the user wishes to set the deviceName to something other than .AOut or .BOut, they can, as long as the other device can also receive the same serial setup commands that .AOut and .BOut can.
Version History
New in version 0.2.0:
• Page size is now completely adjustable by the user.
• There is a 'Copies' option in the Job dialog now, but it only works for
Graphics printing modes.
• Now responds partially to PrGeneral call. Some applications required
PrGeneral to exist for them to print properly.
• Dialogs come up a bit cleaner. (There was some flashing before as it
would set options and center the dialog.)
• Slightly more robust performance in low memory situations.
• Bug fixed where output was not scaled properly for graphics printing.
• System 7 balloon help for the dialogs.
New in version 1.0.0:
• Dialogs are configurable from ResEdit.
• Printer Codes are configurable from ResEdit.
• More Robust.
• Wordy error messages, not just numbers.
• Color Icons.
• Landscape printing mode.
• Fixed command-period cancel bug.
• Fixed Xon-Xoff flow control bug.
• Dialogs pay attention to escape key as cancel.
What does the future hold?
Some time in 93, Apple is supposed to release Quickdraw QD, an extension to quickdraw that is supposed to have a completely new printing manager. It is rumored that the new printing manager will support more printers. Upon Quickdraw QD's release I do not know if I will continue to support my printer driver. It depends on how good a job Quickdraw QD does and if my printer driver will still have a use.
Things I might add if I continue to support the printer driver:
• Support for more types of printers. (Like other than Epson compatible
dot matrix printers, HP Laserjet printers, and any thing else that I might
hear about.)
• Support for color printing for printers that can print color.
• Enlargement and Reduction.
• Built in nice editor for its own resources. (So you don't have to use
ResEdit.)
• Print Spooling.
References
DTS (Apple Developer Technical Support) document 'Learning to Drive' and 'Sample Writer' source code, available on Developer's Essentials CD's (and also possibly ftp.apple.com, but I haven't checked)
Also the HP Deskjet sources in C. (I forget where I got a hold of my copy. -- it's all public domain)